home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: news.sprintlink.net!eskimo!scs
- From: scs@eskimo.com (Steve Summit)
- Subject: Re: HELP : handling segmentation fault
- X-Nntp-Posting-Host: eskimo.com
- Message-ID: <Dnp5Gv.2J8@eskimo.com>
- Sender: news@eskimo.com (News User Id)
- Organization: schmorganization
- References: <4h4h3c$c5o@dingo.cc.uq.oz.au>
- Date: Sun, 3 Mar 1996 14:55:42 GMT
-
- In article <4h4h3c$c5o@dingo.cc.uq.oz.au>,
- s224539@student.uq.edu.au
- (Sahid) writes:
- > Does anyone can explain me how to handle the following error message ?
- > Program received signal SIGSEGV, Segmentation fault... at tsp.c:373
- > 367 conflict check_control_in_t(partitions huge timetable[], meetings huge scs[],int t){
- > 368 unsigned int i,j,scs1,scs2;
- > 369 conflict result={0,0,0},scs12;
- > 370
- > 371 // calculate student and lecturer conflicts ...
- > 372 for(i=0;i<timetable[t].no_scs-1;i++){
- > 373 scs1=timetable[t].index_scs_list[i];
-
- The most likely cause is that the index_scs_list field of the
- t'th instance of the timetable array is not properly allocated.
- You didn't show us the definition of this structure (you should
- have!), but if it's a pointer as opposed to an array, to allow
- dynamic allocation, it's likely that it wasn't allocated
- correctly. It's also possible that timetable[t].no_scs has a
- bogus value (causing i to range wildly), or, less likely, that
- the timetable array itself is improperly allocated.
-
- If the code which sets timetable[t].index_scs_list looks normal,
- then it's likely that some part of the data structure is being
- corrupted due to a stray pointer reference due to a bug somewhere
- else. (These are more frustrating and harder to track down.)
-
- Steve Summit
- scs@eskimo.com
-
- P.S. I like your variable names.
-